<template>
  <div>
    <h2>添 加 区 域</h2>
    <div>
      <el-form :label-position="labelPosition" label-width="80px">
        <el-form-item label="名称">
          <el-input v-model="areaName"></el-input>
        </el-form-item>
        <el-form-item label="林种">
          <el-input v-model="areaForestType"></el-input>
        </el-form-item>
        <el-form-item label="优势树种">
          <el-input v-model="areaTreeType"></el-input>
        </el-form-item>
        <el-form-item label="地类">
          <el-select v-model="value" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.label"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
    </div>
    <el-row>
      <el-button plain @click="addArea()">添加</el-button>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      areaName: "",
      areaForestType: "",
      areaTreeType: "",
      labelPosition: "left",
      options: [
        {
          value: "选项1",
          label: "林地",
        },
        {
          value: "选项2",
          label: "疏林地",
        },
        {
          value: "选项3",
          label: "灌木林",
        },
        {
          value: "选项4",
          label: "苗圃地",
        },
      ],
      value: "",
    };
  },
  methods: {
    async addArea() {
      let paramObj = {
        areaName: this.areaName,
        areaForestType: this.areaForestType,
        areaTreeType: this.areaTreeType,
        areaLandType: this.value,
      };
      let info = await this.ajax.getSubmit("/api/area/add", paramObj);
      console.log(info);

      this.areaName = "";
      this.areaForestType = "";
      this.areaTreeType = "";
      this.value = "";
    },
  },
};
</script>

<style>
</style>